package com.gitee.loyo.result;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * T/CEC 102.3-2016
 * 6.4 请求启动充电
 * 6.4.4 返回值
 */
@Data
@Accessors(chain = true)
public class QueryStartChargeResult implements Serializable {
    /**
     * 充电订单号
     */
    @JsonProperty("StartChargeSeq")
    private String startChargeSeq;
    /**
     * 充电订单状态
     */
    @JsonProperty("StartChargeSeqStat")
    private Integer startChargeSeqStat;
    /**
     * 充电设备接口编码
     */
    @JsonProperty("ConnectorID")
    private String connectorId;
    @JsonProperty("SuccStat")
    private Integer succStat;
    @JsonProperty("FailReason")
    private Integer failReason;


    public boolean succeed(){
        return succStat != null && succStat.intValue() == 0;
    }

    /**
     * 启动中
     * @return
     */
    public boolean isStarting(){
        return startChargeSeqStat != null && startChargeSeqStat.intValue() == 1;
    }

    /**
     * 充电中
     * @return
     */
    public boolean isCharging(){
        return startChargeSeqStat != null && startChargeSeqStat.intValue() == 2;
    }

    /**
     * 停止中
     * @return
     */
    public boolean isStopping(){
        return startChargeSeqStat != null && startChargeSeqStat.intValue() == 3;
    }

    /**
     * 已结束
     * @return
     */
    public boolean isFinished(){
        return startChargeSeqStat != null && startChargeSeqStat.intValue() == 4;
    }
}
